package cn.kgc.springmvc01.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author: mosin
 * @version: v1.0  2022/12/9
 * 使用restful风格设计请求路径
 * localhost:8080/restful
 */
@Controller
@RequestMapping("restful")
public class RestfulController {

    @DeleteMapping("delete/{id}")  //@PathVariable   路径传参{id}
    public String deleteById(@PathVariable Integer id){
        System.out.println("删除请求被接收"+id);
        return "index";  //  转发
    }

    @PostMapping
    public String add(){
        System.out.println("添加请求被接收");
        return "index";  //  转发
    }

    @PutMapping
    public String update(){
        System.out.println("修改请求被接收");
        return "index";  //  转发
    }

    @GetMapping
    public String select(){
        System.out.println("查询请求被接收");
        return "index";  //  转发
    }

}
